home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Text⁄Files / MakeWrite / MakeWrite Folder / MWMaca.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-16  |  7.0 KB  |  258 lines  |  [TEXT/KAHL]

  1. /*
  2.  * MWMaca.h - MacWrite document structures, version 4.5
  3.  * (actually, lots of this is for version 2.2, I was never took it out.)
  4.  *
  5.  * The comments below are mostly non-edifying.  A copy of
  6.  * Macintosh Technical Note 12 is a necessity, as it
  7.  * describes document formats in detail.
  8.  *
  9.  * One difference is that the "active face" in the window variables
  10.  * is really a point size (high byte) and style (low byte), not just
  11.  * a style.    
  12.  */
  13.  
  14.  
  15. # ifndef    _MWMaca_
  16. # define    _MWMaca_
  17.  
  18.  
  19. typedef enum            /* supported versions of MacWrite */
  20. {
  21.     version3 = 3,        /* MacWrite 2.2 */
  22.     version6 = 6        /* MacWrite 4.5 */
  23. };
  24.  
  25.  
  26. typedef enum            /* document types */
  27. {
  28.     mainDoc = 0,
  29.     headDoc = 1,
  30.     footDoc = 2
  31. };
  32.  
  33.  
  34. typedef enum            /* paragraph types */
  35. {
  36.     rulerPara = 0,
  37.     textPara = 1,
  38.     pictPara = 2
  39. };
  40.  
  41.  
  42. typedef enum            /* justification types */
  43. {
  44.     leftJust = 0,
  45.     centerJust = 1,
  46.     rightJust = 2,
  47.     fillJust = 3
  48. } Justification;
  49.  
  50.  
  51. /*
  52.  * Types common to all versions
  53.  */
  54.  
  55. typedef Byte    ByteBool;        /* byte-size boolean */
  56. typedef Byte    UPrintRec[120];    /* 120-byte universal printing record */
  57.                                 /* (anyone know what's in it?) */
  58.  
  59.  
  60. typedef struct Selection
  61. {
  62.     short        selPara;    /* selection paragraph number */
  63.     short        selPos;        /* selection char position (start or end) */
  64. } Selection;
  65.  
  66.  
  67. typedef struct ActiveFace
  68. {
  69.     Byte        faceSize;    /* point size */
  70.     Byte        faceStyle;    /* style */
  71. } ActiveFace;
  72.  
  73.  
  74. typedef struct Format
  75. {
  76.     short        fmtPos;        /* pos of first char format applies to */
  77.     Byte        fmtSize;    /* point size */
  78.     Byte        fmtStyle;    /* style */
  79.     short        fmtFont;    /* font number */
  80. } Format;
  81.  
  82. typedef Format    FormatArray[1];        /* actually variable length */
  83. typedef FormatArray    **FAHandle;
  84.  
  85.  
  86. typedef struct Ruler
  87. {
  88.     short            margLeft;    /* left margin */
  89.     short            margRight;    /* right margin */
  90.     Justification    just;        /* justification */
  91.     Byte            nTabs;        /* number of tabs */
  92.     short            spacing;    /* line spacing = 1 + (spacing/2) */
  93.     short            indent;        /* indentation of first line */
  94.     short            tab[10];    /* tab values */
  95.     Byte            fill[4];    /* unused */
  96. } Ruler;
  97.  
  98.  
  99. /*
  100.  * MacWrite 2.2 (version number 3) data structures
  101.  */
  102.  
  103.  
  104. typedef struct Globals3        /* version 2.2 globals */
  105. {
  106.     short        version;    /* version number (always 3) */
  107.     short        paraOffset;    /* offset to paragraph information */
  108.     short        mainParas;    /* main doc paragraph count */
  109.     short        headParas;    /* header paragraph count */
  110.     short        footParas;    /* footer paragraph count */
  111.     ByteBool    titlePage;    /* title page flag */
  112.     Byte        fill[2];    /* unused */
  113.     ByteBool    showFoot;    /* true if footer displayed */
  114.     ByteBool    showHead;    /* true if header displayed */
  115.     ByteBool    showRuler;    /* true if rulers displayed */
  116.     short        activeDoc;    /* active document */
  117.     short        startPage;    /* starting page number */
  118. } Globals3;
  119.  
  120.  
  121. typedef struct ParaInfo3
  122. {
  123.     short        paraHeight;    /* height of paragraph (pixels) */
  124.     short        paraPos;    /* position from top of page */
  125.     Byte        paraPage;    /* page number */
  126.     Byte        fill[3];    /* unused */
  127. } ParaInfo3;
  128.  
  129.  
  130. typedef struct Windows3        /* version 2.2 window variables */
  131. {
  132.     Selection    selStart;    /* start of selection */
  133.     Selection    selEnd;        /* end of selection */
  134.     short        vertOffset;    /* vertical offset */
  135.     short        redrawPara;    /* first paragraph to redraw */
  136.     Point        pageIconPt;    /* page icon position */
  137.     Point        dateIconPt;    /* date icon position */
  138.     Point        timeIconPt;    /* time icon position */
  139.     Byte        fill[4];    /* unused */
  140.     ByteBool    iconRedraw;    /* true if icons should be redrawn */
  141.     ByteBool    iconFlag;    /* true if rulers shown when icons last drawn */
  142.     short        activeFont;    /* font active when saved */
  143.     ActiveFace    activeFace;    /* face active when saved */
  144. } Windows3;
  145.  
  146.  
  147. typedef struct DocInfo3        /* version 2.2 document information */
  148. {
  149.     Globals3    globals3;    /* globals */
  150.     UPrintRec    uPrintRec;    /* universal printing record */
  151.     Windows3    mainWind3;    /* main doc window information */
  152.     Windows3    headWind3;    /* header window information */
  153.     Windows3    footWind3;    /* footer window information */
  154. } DocInfo3;
  155.  
  156.  
  157. /*
  158.  * MacWrite 4.5 (version number 6) data structures
  159.  */
  160.  
  161.  
  162. typedef struct Globals6        /* version 4.5 globals */
  163. {
  164.     short        version;    /* version number (always 6) */
  165.     short        mainParas;    /* main doc paragraph count */
  166.     short        headParas;    /* header paragraph count */
  167.     short        footParas;    /* footer paragraph count */
  168.     ByteBool    titlePage;    /* title page flag */
  169.     Byte        fill;        /* unused */
  170.     ByteBool    showScrap;    /* true if scrap displayed */
  171.     ByteBool    showFoot;    /* true if footer displayed */
  172.     ByteBool    showHead;    /* true if header displayed */
  173.     ByteBool    showRuler;    /* true if rulers displayed */
  174.     short        activeDoc;    /* active document */
  175.     short        startPage;    /* starting page number */
  176.     long        freePos;    /* free list position */
  177.     short        freeLen;    /* free list length */
  178.     short        freeAlloc;    /* bytes allocated for free list on disk */
  179.     Byte        fill2[14];    /* unused */
  180. } Globals6;
  181.  
  182.  
  183. typedef enum                /* status byte bitmasks */
  184. {
  185.     stJustMask = 0x03,        /* justification code */
  186.     stInUse = 0x04,            /* bit set if paragraph is in use */
  187.     stCompress = 0x08,        /* bit set if text is compressed */
  188.     stOnItsWay = 0x10,        /* bit set if disk i/o started, not done */
  189.     stInMemory = 0x20,        /* bit set if paragraph is in memory */
  190.     stJustify = 0x40,        /* bit set if just code above used */
  191.                             /* otherwise use ruler */
  192.     stDirty = 0x80            /* set if paragraph is dirty */
  193. };
  194.  
  195.  
  196. typedef enum            /* justification codes relating to stJustMask */
  197. {
  198.     stJustLeft = 0x00,
  199.     stJustCenter = 0x01,
  200.     stJustRight = 0x02,
  201.     stJustFull = 0x03
  202. };
  203.  
  204.  
  205. typedef union ParaStOff
  206. {
  207.     Byte        paraStatus;    /* paragraph status */
  208.     long        paraOffset;    /* position of paragraph data */
  209.                             /* (low 3 bytes only) */
  210. } ParaStOff;
  211.  
  212.  
  213. typedef struct ParaInfo6
  214. {
  215.     short        paraHeight;    /* height of paragraph (pixels) */
  216.     short        paraPos;    /* position from top of page */
  217.     long        paraHandle;    /* handle to paragraph */
  218.     ParaStOff    paraStOff;    /* data position/status */
  219.     short        paraLen;    /* length of paragraph data */
  220.     short        paraFmts;    /* common formats */
  221. } ParaInfo6;
  222.  
  223. typedef ParaInfo6    ParaInfoArray6[1];    /* actually variable length */
  224. typedef ParaInfoArray6    **PIAHandle;
  225.  
  226.  
  227. typedef struct Windows6        /* version 4.5 window variables */
  228. {
  229.     Selection    selStart;    /* start of selection */
  230.     Selection    selEnd;        /* end of selection */
  231.     short        vertOffset;    /* vertical offset */
  232.     short        redrawPara;    /* first paragraph to redraw */
  233.     long        infoPos;    /* position of information array */
  234.     short        infoLen;    /* length of information array */
  235.     long        linePos;    /* position of line height array */
  236.     short        lineLen;    /* length of line height array */
  237.     Point        pageIconPt;    /* page icon position */
  238.     Point        dateIconPt;    /* date icon position */
  239.     Point        timeIconPt;    /* time icon position */
  240.     Byte        fill[4];    /* unused */
  241.     ByteBool    iconRedraw;    /* true if ovals (icons) should be redrawn */
  242.     ByteBool    iconFlag;    /* true if rulers shown when ovals last drawn */
  243.     ActiveFace    activeFace;    /* face active when saved */
  244.     short        activeFont;    /* font active when saved */
  245. } Windows6;
  246.  
  247.  
  248. typedef struct DocInfo6        /* version 4.5 document information */
  249. {
  250.     Globals6    globals6;    /* globals */
  251.     UPrintRec    uPrintRec;    /* universal printing record */
  252.     Windows6    footWind6;    /* footer window information */
  253.     Windows6    headWind6;    /* header window information */
  254.     Windows6    mainWind6;    /* main doc window information */
  255. } DocInfo6;
  256.  
  257. # endif
  258.